import functools
import re

from langchain.agents import AgentExecutor, create_react_agent, create_json_chat_agent, create_structured_chat_agent
from langchain_community.tools.tavily_search import TavilySearchResults
from langchain_openai import OpenAI, ChatOpenAI
from langchain.prompts import PromptTemplate, ChatPromptTemplate, SystemMessagePromptTemplate
from langchain.tools import BaseTool, StructuredTool, tool
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.messages import AIMessage
from utils.retry import  retry


@tool
def count_word(text: str) -> int:
    """
    useful when counting the number of words in a paragraph
    """

    return len(text)


@tool
def get_word_length(word: str) -> int:
    """Returns the length of a word."""
    return len(word)



